   /**
 * 日期格式化
 * @author wuhaixiaoyyds
 * @param  getDate("2021-12-1 15:38:16")  实参放日期
 * @returns String
 */
   
    function getDate(dateTimeStamp){
        setInterval(function() {
        getDate();
    }, 60000);
        var minute = 1000 * 60;
    var hour = minute * 60;
    var day = hour * 24;
    var halfamonth = day * 15;
    var month = day * 30;
    if(dateTimeStamp==undefined){
            
            return false;
        }else{
            dateTimeStamp = dateTimeStamp.replace(/\-/g, "/");
            
            var sTime = new Date(dateTimeStamp).getTime();
            
            var now = new Date().getTime();
            
            var diffValue = now - sTime;
            var dayC =diffValue/day;
            var hourC =diffValue/hour;
            var minC =diffValue/minute;
            
    if(dayC>=1){
                console.log(parseInt(dayC) +"天前")
            }
            else if(hourC>=1){
                console.log(parseInt(hourC) +"个小时前")
            }
            else if(minC>=1){
                console.log(parseInt(minC) +"分钟前")
            }else{
                console.log("刚刚")
            }
        }
        
    }
/*    console.log(getDate("2021-12-1 15:38:16")); */


/**
 * 判断什么浏览器内核
 * 判断是pc端还是移动端
 * 判断是否是微信浏览器
 * @author wuhaixiaoyyds
 * @returns 
 */
function myBrowser() {
    var userAgent = navigator.userAgent;
        var isOpera = userAgent.indexOf('Opera') > -1;
        if (userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1 && !isOpera) {
            console.log('IE浏览器')
        }
        if (userAgent.indexOf('Firefox') > -1) {
           console.log('Firefox浏览器')
        }
        if (userAgent.indexOf('Chrome') > -1) {
            console.log('Chrome浏览器')
        }
        if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                
               console.log('mobile')
            }
            else {
              
               console.log('pc')
            }
            if (userAgent.indexOf('micromessenger') > -1) {
            console.log('微信浏览器')
        }else{console.log('不是微信浏览器') } 

            
    }
/*     myBrowser() */